package measures;

import java.util.List;

import basics.DenseMatrix;
import basics.DenseVector;
import basics.Vector;
import basics.VectorMatrix;

public abstract class Measure {

	public abstract double measure(Vector x1, Vector x2);

	public DenseMatrix getMatrix(List<Vector> ds) {
		DenseMatrix m = new DenseMatrix(ds.size(), ds.size());

		for (int i = 0; i < ds.size(); i++) {
			for (int j = 0; j < i; j++) {
				m.set(measure(ds.get(i), ds.get(j)), i, j);
				m.set(m.get(i, j), j, i);
			}
		}

		return m;
	}

	public DenseVector measure(Vector v, List<Vector> ds) {
		DenseVector d = new DenseVector(ds.size());
		for (int i = 0; i < ds.size(); i++) {
			d.set(measure(v, ds.get(i)), i);
		}
		return d;
	}
}
